﻿using CCWin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TelephoneYiShou;

namespace customer
{
    public partial class cusAdd : Skin_Mac
    {
        public cusAdd()
        {
            InitializeComponent();
        }

        private void btn_add_Click(object sender, EventArgs e)
        {
            //添加
            
            string customername = txt_name.Text;
            string sex = cmb_sex.Text;
            string phone = txt_tel.Text;           
            string address = txt_address.Text;
            if (string.IsNullOrEmpty(customername) ||
                string.IsNullOrEmpty(sex) || string.IsNullOrEmpty(phone) ||
                string.IsNullOrEmpty(address))
            {
                MessageBox.Show("信息输入不完整！");
                return;//直接返回
            }
            string sql = string.Format("insert into Client Values" +
                "('{0}','{1}','{2}','{3}')",customername, sex,phone,address);
            if (DBHelper.ExecuteNonQuery(sql))
            {
                MessageBoxEx.Show("客户信息添加成功！");
            }
            else
            {
                MessageBoxEx.Show("添加失败,请联系管理员!");
            }
        }

        private void btn_exit_Click(object sender, EventArgs e)
        {
            //退出
            this.Close();
        }

    }
}
